#ifndef MAPIO_H
#define MAPIO_H

#include <string>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_ttf.h>
#include "Manager.h"
#include "Timer.h"
#include "Dot.h"
#include "Background.h"

using namespace std;

class MapIO
{
private:
	Manager* manager;
	Dot* dot;
	Timer* timer;
	Background** bg;
	
	SDL_Surface* screen;
	SDL_Surface* background;
	SDL_Surface* bird[BIRD_NUM];
	SDL_Surface* grass;
	SDL_Surface* egg;
	SDL_Surface* helmet;
	SDL_Surface* spine;
	SDL_Surface* pig1;
	TTF_Font* arialFont;
	SDL_Rect camera;

	void setBg();
	TTF_Font* loadFont(string filePath, int size);
	void loadElement();
	void setInfoSurface();
	string conToString(int n);
	SDL_Surface* getElement(int n);

public:
	MapIO();
	~MapIO();
	static SDL_Surface* loadImg(string filePath);
	void getInput();
	void output();
	void showBg();
	void showMap();
	bool checkCollision(SDL_Rect* A, SDL_Rect* B);
	void applySurface(int x, int y, SDL_Surface* source, SDL_Surface* dest, SDL_Rect* clip = NULL);

	SDL_Rect*  getCamera();
};

#endif